package de.softwareforge.published.proxy;

/*
 * Copyright (C) 2007-2008 Henning P. Schmiedehausen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Map;

/**
 * Controls the Proxy factory policy.
 *
 * @author <a href="mailto:henning@schmiedehausen.org">Henning P. Schmiedehausen</a>
 * @version $Id: ProxyController.java 102 2008-02-24 22:14:11Z hps@intermeta.de $
 * @api.level published unstable
 */

public interface ProxyController
{
    /**
     * Returns a map of method names to invokers. When a method is invoked, the
     * invoker is used to do this.
     *
     * @return A map of method names to invokers. Can be empty, must not be null.
     */
    Map<String, Invoker> getInvokers();

    /**
     * Allows vetoing whether an object should be added to an array with the
     * given component type or not.
     *
     * @param obj The object to add to the array.
     * @param componentType The class type of the array.
     *
     * @return True to veto the addition, False to allow it.
     */
    boolean vetoAddToArray(Object obj, Class componentType);

    /**
     * Whether a given object should be wrapped in a proxy or not.
     *
     * @param obj The object to check.
     * @return True to veto the wrapping, false if the object should be wrapped.
     */
    boolean vetoWrapInProxy(Object obj);
}

